Additionally to simple strings, you can use expressions to set the
value of an attribute. Expressions must be enclosed
inside "(
" and ")
".
Inside expressions, you can refer to attributes simply by their name. String constants must be enclosed inside quotes.
Example:<$define name:string="hugo.gif"> <IMG SRC=(name) ALT="name">will be converted to
<IMG SRC="hugo.gif" ALT="name">
<$macro>
or
<$define>
<$define name:string="hugo"> <$define here:string="here"> <IMG SRC=(name+".gif") ALT=(name+" was "+here)> <$if (name="hugo")> This is hugo! <$else> Maybe it's sepp? </$if> AmigaOS version: <$insert text=(GetEnv "KickStart")>will be converted to
<IMG SRC="hugo.gif" ALT="hugo was here"> This is hugo! AmigaOS version: 40.63
Important: Different to most programming languages, hsc does not support priorities for different operators. Therefor, expressions are simply processed sequentialy (I'm too lazy to build a tree).
But you can use nested brackets within complex expressions.
If you pass an expression to a boolean attribute, the expression is
evaluated as before. If the expression returned an empty string,
the boolean attribute is set to FALSE
. This means, that
it is removed from the tag/macro-call.
Any none-empty string enables the attribute.
Example:<IMG SRC=(name) ALT="nufin" ISMAP=(name="map.gif")>will be converted to
<IMG SRC="hugo.gif" ALT="nufin">if
name
has been set to "hugo.gif"
, or to
<IMG SRC="map.gif" ALT="nufin" ISMAP>
if name
has been set to "map.gif"
. Note that
only the second call enables the boolean attribute ISMAP
,
while it gets stripped for the first call.